let express=require(`express`)

let app=express()

let jwt=require(`express-jwt`)

app.listen(`3000`,()=>console.log(`ok`))

app.use(express.urlencoded({extended:true}))

app.use(`uploads`,express.static(`./uploads`))

app.use(
    jwt({
        secret:`hehe`,
        algorithms:[`HS256`]
    }).unless({
        path:['/a/b/login'],
    }),
)

let category=require(`./2.category`)
let login=require(`./1.1login`)
app.use(`/c/d`,category)
app.use(login)
app.use((err,req,res,next)=>{
    if(err.name===`UnauthorizedError`){
        res.status(401).send({status:1,message:`身份认证失败！`})
    }
})



